﻿<UserControl x:Class="MicroBlogClient.UCSettings"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d"  IsVisibleChanged="UserControl_IsVisibleChanged"
        xmlns:controls="clr-namespace:Rabbit.Controls;assembly=Rabbit.Controls" Height="365"  d:DesignHeight="365" d:DesignWidth="262" Width="262">
    <Border Style="{DynamicResource MainWindowBorder}" x:Name="MainBorder">
        <Border.Effect>
            <DropShadowEffect Opacity="0.5"/>
        </Border.Effect>
        <Grid Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="20"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="35"/>
            </Grid.RowDefinitions>
            <Canvas>
                <TextBlock Canvas.Left="15" Style="{DynamicResource AppTitleStyle}">个人设置</TextBlock>
                <Button Style="{DynamicResource WindowTitleBarButtonStyle}" Canvas.Right="10" ToolTip="关闭"  Click="btnClose_Click">
                    <Button.Content>
                        <controls:ImageEx Source="{DynamicResource CloseButton}" Height="12" Width="14"/>
                    </Button.Content>
                </Button>
            </Canvas>
            <StackPanel Grid.Row="1" Background="White">
                <StackPanel.Resources>
                    <Style TargetType="TextBlock">
                        <Setter Property="VerticalAlignment" Value="Center"/>
                    </Style>
                </StackPanel.Resources>
                <Expander Header="基本设置" Margin="0" IsExpanded="{Binding Mode=TwoWay,ElementName=exHotKeySettings,Path=IsExpanded,Converter={StaticResource BooleanToContrastConverter}}" x:Name="exBasicSettings">
                    <Grid Margin="20,0,0,0" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="32"/>
                            <RowDefinition Height="28"/>
                            <RowDefinition Height="28"/>
                            <RowDefinition Height="70"/>
                            <RowDefinition Height="32"/>
                            <RowDefinition Height="30"/>
                            <RowDefinition Height="32"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width=".3*"/>
                            <ColumnDefinition Width=".5*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="消息更新间隔:"  Grid.Row="0" Grid.Column="0"/>
                        <StackPanel Orientation="Horizontal" Margin="5"  VerticalAlignment="Center" Grid.Row="0" Grid.Column="1">
                            <Slider x:Name="sldMessageUpdateInterval" 
                                Value="{Binding Path=UpdateInterval}"  Maximum="300" Minimum="40"
                                TickFrequency="1"  Width="90" LargeChange="10" 
                                IsSnapToTickEnabled="True"/>
                            <TextBlock Text="{Binding Path=Value,ElementName=sldMessageUpdateInterval,StringFormat={}{0:###}秒}" Width="35" VerticalAlignment="Center"/>
                        </StackPanel>

                        <TextBlock Text="托盘闪动:" Grid.Row="1" Grid.Column="0"/>
                        <StackPanel  Margin="5"  Grid.Row="1" Grid.Column="1">
                            <CheckBox Content="闪烁托盘图标" x:Name="chkTwinkleSysTrayIcon" IsChecked="{Binding IsTwinkleSysTrayIcon}"/>
                        </StackPanel>

                        <TextBlock Text="声音提醒:"  Grid.Row="2" Grid.Column="0"/>
                        <StackPanel VerticalAlignment="Center" Margin="5" Orientation="Horizontal"  Grid.Row="2" Grid.Column="1">
                            <CheckBox Content="播放声音" x:Name="chkIsPlayingSound" IsChecked="{Binding IsPlayingSound}"/>
                            <TextBlock><Hyperlink Click="PlaySound_Click">试听</Hyperlink></TextBlock>
                        </StackPanel>

                        <TextBlock Text="气泡提醒:"  Grid.Row="3" Grid.Column="0"/>
                        <StackPanel VerticalAlignment="Center" Margin="5"  Grid.Row="3" Grid.Column="1">
                            <CheckBox Content="新微博到达时" x:Name="chkPopupForNewStatus" IsChecked="{Binding PopupForNewStatus}"/>
                            <CheckBox Content="新评论" x:Name="chkPopupForNewComment"  IsChecked="{Binding PopupForNewComment}"/>
                            <CheckBox Content="新@我" x:Name="chkPopupForNewMetionedMe"  IsChecked="{Binding PopupForMetionedMe}"/>
                            <CheckBox Content="新私信" x:Name="chkPopupForNewLetter"  IsChecked="{Binding PopupForNewLetter}"/>
                        </StackPanel>

                        <TextBlock Text="气泡显示时间:"  Grid.Row="4" Grid.Column="0"/>
                        <StackPanel VerticalAlignment="Center" Margin="5" Orientation="Horizontal" Grid.Row="4" Grid.Column="1">
                            <Slider x:Name="sldPopupMessageShowTime" 
                                Value="{Binding Path=PopupMessageShowTime}"  Maximum="180" Minimum="10"
                                TickFrequency="5"  Width="90" LargeChange="10"/>
                            <TextBlock Text="{Binding Path=Value,ElementName=sldPopupMessageShowTime,StringFormat={}{0:###}秒,Mode=OneWay}" Width="35" VerticalAlignment="Center"/>
                        </StackPanel>

                        <TextBlock Text="皮肤:"   Grid.Row="5" Grid.Column="0"/>
                        <ComboBox VerticalAlignment="Center"  SelectionChanged="cmbTheme_SelectionChanged" SelectedValue="{Binding Theme}" x:Name="cmbTheme" SelectedValuePath="Value" DisplayMemberPath="Name" Margin="5"  Grid.Row="5" Grid.Column="1"/>

                        <TextBlock Text="主界面透明度:"  Grid.Row="6" Grid.Column="0"/>
                        <StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" Margin="5">
                            <Slider Maximum="1"  x:Name="sldMainWindowOpacity"
                            Minimum="0.3"  
                            ValueChanged="sldMainWindowOpacity_ValueChanged"
                            Width="90"  LargeChange="0.1" Value="{Binding Path=MainWindowOpacity}"
                            TickFrequency="0.1"
                            />
                            <TextBlock Text="{Binding Path=Value,ElementName=sldMainWindowOpacity,StringFormat={}{0:0.00},Mode=OneWay}" VerticalAlignment="Center"/>
                        </StackPanel>
                    </Grid>
                </Expander>
                <Expander Header="热键设置" Grid.Row="1" IsExpanded="False" x:Name="exHotKeySettings">
                    <Grid  Margin="20,0,0,0">
                        <Grid.Resources>
                            <Style TargetType="controls:HotKeyGenerateTextBox">
                                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                <Setter Property="VerticalContentAlignment" Value="Center"/>
                                <Setter Property="Margin" Value="2,5,5,5"/> 
                            </Style>
                        </Grid.Resources>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="30"/>
                            <RowDefinition Height="30"/>
                            <RowDefinition Height="30"/>
                            <RowDefinition Height="30"/>
                            <RowDefinition Height="30"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width=".3*"/>
                            <ColumnDefinition Width=".7*"/>
                        </Grid.ColumnDefinitions>
                             <TextBlock Text="截屏:" Grid.Row="0"/>
                        <controls:HotKeyGenerateTextBox NoHotKeyTip="无" Grid.Column="1" Grid.Row="0"  Text="{Binding  CaptureScreenHotKey,NotifyOnValidationError=True}" GotFocus="HotKeyGeneratorTextBox_GotFocus"  Name="txtCaptureScreenHotKey" />

                        <TextBlock Text="获取私信:" Grid.Row="1"/>
                        <controls:HotKeyGenerateTextBox Grid.Column="1" Grid.Row="1" NoHotKeyTip="无"  Text="{Binding GetLetterHotKey}" GotFocus="HotKeyGeneratorTextBox_GotFocus"  Name="txtGetLetterHotKey" />
                           
                            <TextBlock Text="获取评论:" Grid.Row="2"/>
                        <controls:HotKeyGenerateTextBox NoHotKeyTip="无" Grid.Column="1" Grid.Row="2"  Text="{Binding GetCommentHotKey}" GotFocus="HotKeyGeneratorTextBox_GotFocus"  Name="txtGetCommentHotKey" />
                        
                        <TextBlock Text="获取新微博:" Grid.Row="3"/>
                        <controls:HotKeyGenerateTextBox NoHotKeyTip="无" Grid.Column="1" Grid.Row="3"  Text="{Binding GetStatusHotKey}" GotFocus="HotKeyGeneratorTextBox_GotFocus"  Name="txtGetStatusHotKey" />
                        <TextBlock Text="提到我的:" Grid.Row="4"/>
                        <controls:HotKeyGenerateTextBox Grid.Column="1"  Grid.Row="4" NoHotKeyTip="无" Text="{Binding GetMetionedMeHotKey}" GotFocus="HotKeyGeneratorTextBox_GotFocus" Name="txtMetionedMeHotKey"  />
                    </Grid>
                </Expander>
            </StackPanel>
            
            <Grid Background="White" Grid.Row="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.3*" />
                    <ColumnDefinition Width="0.3*"/>
                    <ColumnDefinition Width="0.4*"/>
                </Grid.ColumnDefinitions>
                <Button HorizontalAlignment="Right" Margin="0,0,15,0" Width="Auto" Padding="10,0,10,0" Click="btnSave_Click">保存</Button>
                <Button Grid.Column="1" HorizontalAlignment="Left" Margin="15,0,0,0"  Width="Auto" Padding="10,0,10,0" Click="btnClose_Click">取消</Button>
                <Button Grid.Column="2" HorizontalAlignment="Left" Margin="15,0,0,0"  Width="Auto" Padding="10,0,10,0" Click="btnReset_Click">恢复默认</Button>
            </Grid>
        </Grid>
    </Border>
</UserControl>
